import smtplib
from email.header import Header
from email.mime.text import MIMEText

#邮箱服务器地址
mailserver = "smtp.163.com"
#发送邮箱
username_send = 'm13614533458@163.com'
#密码/授权码
password = 'lai'
#收件邮箱
username_recv = '3477982476@qq.com'
#邮件正文内容
mail = MIMEText('灿白')
#邮件主题
mail['Subject'] = 'chanbaek is real'
#发件人
mail['From'] = username_send
#收件人
mail['To'] = username_recv
#连接邮箱(网易)
smtp = smtplib.SMTP(mailserver,port=25)
#连接邮箱(QQ)
# smtp=smtplib.SMTP_SSL('smtp.qq.com',port=465)
#登录邮箱
smtp.login(username_send,password)
#发件人,收件人,将文件内容变为字符串类型
smtp.sendmail(username_send,username_recv,mail.as_string())
#退出
smtp.quit()
#发送成功
print ('success')